package com.orilore.gb.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.orilore.gb.entity.XDepart;

public class XDepartDao {
	
	
	public List<XDepart>  selectAllXDepart(Connection conn) throws Exception{
		
		List<XDepart> list =new ArrayList<XDepart>();
		
		
		String sql = "select * from x_depart";
		
		
		PreparedStatement ps = conn.prepareStatement(sql);
		  
		
		ResultSet rs = ps.executeQuery();
		
		
		while(rs.next()) {
			
			XDepart depart = new XDepart();
			
			
			depart.setId(rs.getInt(1));
			
			depart.setDname(rs.getString(2));
			
			
			list.add(depart);
			
			
			
		}
		
		rs.close();
		
		
		ps.close();
		
		
		return list;
	}
	
	

}
